package com.iretailer.report.web.report;

import com.iretailer.report.influxdb.dao.InfluxdbDao;
import com.iretailer.report.model.AlarmEasModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @Program: report
 * @Description:
 * @Author: Bennie
 * @Date: 2021-02-07 16:51
 **/

@RestController
public class AlarmEasController {

    @Autowired
    private InfluxdbDao influxdbDao;

    @RequestMapping("/report/AlarmEas.action")
    List<AlarmEasModel> alarmEas(@RequestBody Map<String, Object> param) {
        List<Integer> deviceIds = (List<Integer>) param.get("deviceIds");
        String startDate = (String) param.get("StartDate");
        String endDate = (String) param.get("EndDate");
        return influxdbDao.selectSummaryAlarmEas("Asia/Shanghai", deviceIds, startDate + " 00:00:00",
                endDate + " 23:59:59", "4m");
    }

}
